import request from '../utils/request.js';

//  获取文章
export const postArticlei = (url, page, count) => {
  return request({
    method: 'post',
    url: url,
    data: { pageNum: page, pageSize: count },
  });
};
//  最新文章
export const postNewArticle = (page, count) => {
  return request({
    method: 'post',
    url: '/es/newestArticle',
    data: { pageNum: page, pageSize: count },
  });
};

//  根据 id 查询 文章详情
export const postArtDetails = id => {
  return request({
    method: 'post',
    url: `/es/findByIdArticle/${id}`,
  });
};

// 上传图片
export const richTextImgUpload = formData => {
  return request({
    method: 'post',
    url: '/upload/upload',
    data: { img: formData },
  });
};

// 文章点赞
export const likeArticle = obj => {
  const articleLikes = {
    articleId: 'uxnqNH4BnMkda92A934l',
    likeId: 1404448588146192396,
    whetherAttention: true,
  };
  return request({
    method: 'post',
    url: '/es/articleLikes',
    likeArticles: articleLikes,
  });
};
